package com.bestcem.xm.wallet.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * 公司钱包配置充值限制枚举
 *
 * @author wangyunyun <yunyun.wang@idiaoyan.com>
 * @version v1.0
 * @date 2022/5/16 10:11
 */
@Getter
@AllArgsConstructor
public enum OrgWalletConfigRechargeLimitEnum {

    /**
     * 充值限制枚举
     */
    NO_LIMIT(0, "不限制"),
    ONLY_ORG_ACCOUNT(1, "仅限本租户账号可充值"),
    ;

    private Integer type;

    private String desc;

    /**
     * 通状态获取枚举
     *
     * @param value 类型
     * @return OrgWalletConfigRechargeLimitEnum
     * @author wangyunyun <yunyun.wang@idiaoyan.com>
     * @date 2022/5/17 15:11
     */
    public static OrgWalletConfigRechargeLimitEnum getByValue(Integer value) {
        if (value == null) {
            return null;
        }
        return Stream.of(values()).filter(t -> t.getType().equals(value)).findFirst().orElse(null);
    }
}
